using HMS.Contracts.Entities;
using HMS.Core.DataProtocol;
using HMS.Services;

namespace HMS.Controllers;

[ApiController]
public class HotelConfigController : ControllerBase
{
    private readonly IHotelConfigService _service;

    public HotelConfigController(IHotelConfigService service)
    {
        _service = service;
    }

    // POST api/HotelConfig/Create
    [Authorize]
    [HttpPost("api/HotelConfig/Create")]
    public Task<OperationalResult> Createsync([FromBody] HotelConfig.CreateRequest createRequest)
    {
        return _service.AddAsync(createRequest, HttpContext.RequestAborted);
    }

    // GET api/HotelConfig/Get/1
    [Authorize]
    [HttpGet("api/HotelConfig/Get/{Id}")]
    public Task<OperationalResult<HotelConfig.GetResponse>> GetAsync(int Id)
    {
        return _service.GetAsync(Id, HttpContext.RequestAborted);
    }

    // GET api/HotelConfig/GetList
    [Authorize]
    [HttpGet("api/HotelConfig/GetList")]
    public Task<ListResult<HotelConfig.GetListResponse>> GetListAsync()
    {
        return _service.GetListAsync(HttpContext.RequestAborted);
    }
}